//
//  QiuView.m
//  核心动画
//
//  Created by chichaojituan521 on 2017/6/1.
//  Copyright © 2017年 linch. All rights reserved.
//

#import "QiuView.h"

@implementation QiuView


// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    CGPoint origin = CGPointMake(150, 200);
    CGFloat radius = 100.0f;
    
    UIBezierPath *ballPath = [UIBezierPath bezierPathWithArcCenter:origin radius:radius startAngle:_progressStart endAngle:_progressEnd clockwise:YES];
    
    [[UIColor yellowColor]set];
    [ballPath fill];
    
    //    在球形的外面绘制一个描边空心的圆形，不然很难看
    UIBezierPath *strokePath = [UIBezierPath bezierPathWithArcCenter:origin radius:radius startAngle:0 endAngle:M_PI*2 clockwise:YES];
    [[UIColor redColor]set];
    [strokePath stroke];
}
-(void)setProgressValue:(float)progressValue
{
    _progressValue = progressValue;
    _progressStart = M_PI_2 - _progressValue*M_PI;
    _progressEnd = M_PI_2 + _progressValue *M_PI;
    [self setNeedsDisplay];
}

@end
